Skip to content

MQE-1704: MFTF Compatibility with PHPUnit 9 #657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 17, 2020
Merged

MQE-1704: MFTF Compatibility with PHPUnit 9 #657

merged 13 commits into from
Apr 17, 2020

Conversation

soumyau
Copy link
Contributor

@soumyau soumyau commented Mar 26, 2020

Upgraded PhpUnit + Codeception

Changes -

  • Updated php to use >= 7.3 versions
  • Updated codeception to 4.1.4
  • Updated PHPUnit to 9
  • Override switchToIFrame to support by switching by ID
  • Removed pauseExecution to use I->pause() for debugging
  • And other PHPUnit 9 related changes

Description

Fixed Issues (if relevant)

  1. magento/magento2-functional-testing-framework#<issue_number>: Issue title
  2. ...

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/verification tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
  • Changes to Framework doesn't have backward incompatible changes for tests or have related Pull Request with fixes to tests

Upgraded PhpUnit + Codeception
@coveralls
Copy link

coveralls commented Mar 26, 2020

Coverage Status

Coverage decreased (-0.4%) to 52.758% when pulling 9fd684f on MQE-1704 into 9799582 on MFTF3.0.0-RC2.

soumyau added 3 commits March 26, 2020 09:02
Added codeception modeule-* dependencies to fix functional tests
soumyau added 6 commits March 29, 2020 01:56
Removed pauseExecution to use pause
Override switchToIFrame to include find by ID.
fixed static checks, fixed for MagentoAllureAdapter
Updated to PHPUnit 9 and fixed unit tests
added Pause to MagentoWebDriver.php for step generation in console/allure
@soumyau soumyau changed the title MQE-1704: MFTF Compatibility with PHPUnit 8 MQE-1704: MFTF Compatibility with PHPUnit 9 Apr 15, 2020
@@ -309,9 +315,28 @@ function () use ($rootStep, $formattedSteps) {

$this->getLifecycle()->getStepStorage()->put($rootStep);

$this->addAttachmentEvent($testEvent);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed in codeception that requires this new line + functions?

Copy link
Contributor Author

@soumyau soumyau Apr 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testEnd of codeception has changed to the below, it takes a TestEvent parameter and fires an event. I don't see any changes to due to this addition in test runs/allure. I'm not 100% sure what this change does, any thoughts? TestEvent needed to be used in overriding function in MagentoAllureAdapter, hence the addition.

    public function testEnd(TestEvent $testEvent)
    {
        // attachments supported since Codeception 3.0
        if (version_compare(Codecept::VERSION, '3.0.0') > -1 && $testEvent->getTest() instanceof Cest) {
            $artifacts = $testEvent->getTest()->getMetadata()->getReports();
            foreach ($artifacts as $name => $artifact) {
                Allure::lifecycle()->fire(new AddAttachmentEvent($artifact, $name, null));
            }
        }
        $this->getLifecycle()->fire(new TestCaseFinishedEvent());
    }

* @return void
* @throws \Exception
*/
public function switchToIFrame($locator = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a backwards compatible workaround to a new codeception version right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, switchToIFrame of PHPUnit9 takes in a name, css or xpath. Looks like it dropped support for Id. Overriding to support Id since a lot of tests find by Id.

soumyau and others added 2 commits April 17, 2020 09:49
#673)

* MQE-2078: [PHPUnit 9] assertContains and assertNotContains breaking changes
added new actions
assertStringContainsString
assertStringContainsStringIgnoringCase

* MQE-2078: [PHPUnit 9] assertContains and assertNotContains breaking changes

Added additional documentation for assertContains

* Grammar fixes

Co-authored-by: Donald Booth <dobooth@adobe.com>
@soumyau soumyau merged commit 5ac5683 into MFTF3.0.0-RC2 Apr 17, 2020
@soumyau soumyau deleted the MQE-1704 branch April 30, 2020 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants